package collection;

import java.util.*;
import java.util.stream.Collectors;

public class list1 {

    public static void main(String[] args) {
//        char a = '你';
//        System.out.println(a);

//        int a= 2;
//        long b = 3;
//        a = (int)b;
//        b = a;
//
//        float c = 1.0f;
//        double d = 3;
//        c = (float) d;
//        d = c;
        List<String> l1 = new ArrayList<>();
        List<String> ss1 = Collections.synchronizedList(l1);
        Random random = new Random();
        random.nextInt(5);
        for (int i = 0; i < 10; i++) {
            System.out.println(random.nextInt(5));
        }

        String str = "abc";
        System.out.println(str.hashCode());
        Integer i1 = 12;
        System.out.println(i1.hashCode());

//        Map
        ArrayList<String> list =new ArrayList<>();
        list.add("a");
        list.add("b");
        list.add("c");
        System.out.println(list.size());
        list.add(3,"e");
        System.out.println(list);
        ArrayList<String> c1 = list.stream().map((i) -> i).collect(Collectors.toCollection(ArrayList::new));
        List<String> collect = list.stream().map((i) -> i).collect(Collectors.toList());
        Map<String, String> map1 = list.stream().map((i) -> i).collect(Collectors.toMap((i) -> {
            return i;
        }, (i) -> {
            return i;
        }));

        ArrayList<String> c2 = new ArrayList<>(list);
        ArrayList<String> c3 =new ArrayList<>();
        c3.addAll(list);
        list.add("f");
        System.out.println(list);
        System.out.println(map1);


    }
}
